// Learn cc.Class:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

const GameDataManger = require("../GameDataManger");
const UIPanelManager = require("../UIPanelManager");

cc.Class({
    extends: cc.Component,

    properties: {

    },

    onEnable(){

    },

    refreshgame(){

    },

    onBtnClick(event, str){
        if (str == "setting"){
            UIPanelManager.open(UIPanelManager.settingNode);
        }else if (str == "sideNode"){
            UIPanelManager.open(UIPanelManager.sideBarReward);
        }else if (str == "sign"){
            UIPanelManager.open(UIPanelManager.signNode);
        }else if (str == "grade"){
            UIPanelManager.open(UIPanelManager.gradeNode);
        }else if (str == "levelNode"){
            UIPanelManager.open(UIPanelManager.levelNode);
        }
        else if (str == "friend"){
            UIPanelManager.open(UIPanelManager.matchFriendNode);
        }
        else if (str == "videoBtn"){
            AD.showAD(()=>{
                //金币+10
                GameDataManger.gold+=10;
                cc.systemEvent.emit('saveUserData');
            },this);
        }
    }

    // update (dt) {},
});
